package com.java.netty.nio.netty.http;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;

/**
 * @Author: Dgg
 * @Date: 2021/12/23 20:36
 */
public class TestServer {
	public static void main(String[] args) throws Exception {
		EventLoopGroup boosGroup = new NioEventLoopGroup(1);
		EventLoopGroup workerGroup = new NioEventLoopGroup();
		try {
			ServerBootstrap serverBootstrap = new ServerBootstrap();


			serverBootstrap.group(boosGroup, workerGroup)
					.channel(NioServerSocketChannel.class)
					.childHandler(new TestServerInitializar());

			ChannelFuture sync = serverBootstrap.bind(8099).sync();

			sync.channel().closeFuture().sync();
		} finally {
			boosGroup.shutdownGracefully();
			workerGroup.shutdownGracefully();
		}

	}
}
